package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 计算PI
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_25 {
	
	private static double value(long n) {
		
		double sum=0;
		for(int i=1;i<=n;i++) {
			sum+=Math.pow(-1, i+1)/(2*i-1);
		}
		return sum*4.0;
		
	}
	
	public static void main(String[] args) {
		
		for(long  i=10000;i<=100000;i+=10000) {
			System.out.printf("n = %d PI is: %.6f \n",i,value(i));
		}
		
		
		
	}

}
